﻿using CleanArchitecture.Infrastructure.Entities;
using Microsoft.AspNetCore.Mvc.Rendering;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;

namespace CleanArchitecture.Infrastructure.Models.SystemManage
{
    /// <summary>
    /// Represents a news item model
    /// </summary>
    public partial class SystemDataDicButtonModel : BaseEntityModel
    {
        #region Fields
        //https://www.davepaquette.com/archive/2015/05/18/mvc6-select-tag-helper.aspx
        public IList<SelectListItem> AvailableButtonTypes { get; set; }
        #endregion
        #region Ctor
        public SystemDataDicButtonModel()
        {
            AvailableButtonTypes = new List<SelectListItem>()
            {
                new SelectListItem("全局操作", nameof(EntityEnumConfig.SystemModuleButtonType.PageBtn), true),
                new SelectListItem("数据操作", nameof(EntityEnumConfig.SystemModuleButtonType.RecordBtn), false),
                new SelectListItem("工具栏辅助", nameof(EntityEnumConfig.SystemModuleButtonType.GroupToolBtn), false),
            };
        }
        #endregion
        #region Properties
        public EntityEnumConfig.SystemModuleButtonType ButtonType { get; set; }
        [DisplayName("按钮类型")]
        public string ButtonTypeDisplay { 
            get 
            {
                return AvailableButtonTypes.FirstOrDefault(t => t.Value == this.ButtonType.ToString()).Text;
            }
        }
        [DisplayName("按钮名称")] 
        public string ButtonName { get; set; }
        [DisplayName("显示名称")]
        public string DisplayName { get; set; }
        [DisplayName("按钮样式")]
        public string ButtonClass { get; set; }
        [DisplayName("按钮图标")]
        public string IconCssClass { get; set; }
        [DisplayName("阈值")]
        public string EventName { get; set; }
        [DisplayName("排序")]
        public int DisplayOrder { get; set; }
        [DisplayName("状态")]
        public EntityEnumConfig.YesorNo IsActive { get; set; }
        #endregion
    }
}
